using System;
using System.Collections.Generic;
using System.Text;
using THSLib;
using THSERP.BaseProvider;
using THSERP.BusinessEntities;
namespace THSERP.Modules.CompanyConstant
{
    public class CompanyConstantEntities : ERPModuleEntities
    {
        #region Constants
        public const string cstCSCompanysObjectName = "CSCompanys";
        public const string cstHRShiftObjectName="HRShifts";
        public const string cstGGEBalancesObjectName = "GEBalances";
        #endregion

        #region Variables
        protected CSCompanysInfo _cSCompanysObject;
        protected HRShiftsInfo _hRShiftsObject;
        protected GEBalancesInfo _gEBalancesObject;
        public THSList<GENumberingInfo> lstGENumberings;
        public THSList<HRShiftsInfo> lstHRShifts;
        public THSList<GEBalancesInfo> lstGEBalances;
        #endregion

        #region Public Properties
        public CSCompanysInfo CSCompanysObject
        {
            get
            {
                return _cSCompanysObject;
            }
            set
            {
                _cSCompanysObject = value;
            }
        }
        public HRShiftsInfo HRShiftsObject
        {
            get { return _hRShiftsObject; }
            set { _hRShiftsObject = value; }
        }
        public GEBalancesInfo GEBalancesObject
        {
            get { return _gEBalancesObject; }
            set { _gEBalancesObject = value; }
        }
        public THSList<GENumberingInfo> GENumberingsList
        {
            get
            {
                return lstGENumberings;
            }
            set
            {
                lstGENumberings = value;
            }
        }
        public THSList<HRShiftsInfo> HRShiftsList
        {
            get { return lstHRShifts; }
            set { lstHRShifts = value; }
        }
        public THSList<GEBalancesInfo> GEBalancesList
        {
            get { return lstGEBalances; }
            set { lstGEBalances = value; }
        }
        #endregion

        #region Constructor
        public CompanyConstantEntities()
            : base()
        {
            CSCompanysObject = (CSCompanysInfo)new CSCompanysController().GetFirstObject();
            if (CSCompanysObject == null)
                CSCompanysObject = new CSCompanysInfo();
            HRShiftsObject = new HRShiftsInfo();
            GEBalancesObject = new GEBalancesInfo();
            GENumberingsList = new THSList<GENumberingInfo>();
            HRShiftsList = new THSList<HRShiftsInfo>();
            GEBalancesList = new THSList<GEBalancesInfo>();
        }
        #endregion

        public override void InitModuleEntity()
        {
            base.InitModuleEntity();

            UpdateModuleObjectBindingSource(cstCSCompanysObjectName);
            UpdateModuleObjectBindingSource(cstHRShiftObjectName);
            UpdateModuleObjectBindingSource(cstGGEBalancesObjectName);
        }

        #region Init Main Object,Module Objects functions
        public override void InitModuleObjects()
        {
            ModuleObjects.Add(CompanyConstantEntities.cstCSCompanysObjectName, CSCompanysObject);
            ModuleObjects.Add(cstHRShiftObjectName,HRShiftsObject);
            ModuleObjects.Add(cstGGEBalancesObjectName, GEBalancesObject);
        }

        public override void InitModuleObjectList()
        {
            GENumberingsList.InitTHSList(this, String.Empty, THSUtil.GetTableNameFromBusinessObjectType(typeof(GENumberingInfo)));
            HRShiftsList.InitTHSList(this, String.Empty, THSUtil.GetTableNameFromBusinessObjectType(typeof(HRShiftsInfo)));
            GEBalancesList.InitTHSList(this, string.Empty, THSUtil.GetTableNameFromBusinessObjectType(typeof(GEBalancesInfo)));
        }

        public override void InitGridControlInTHSList()
        {
            GENumberingsList.InitTHSListGridControl();
            HRShiftsList.InitTHSListGridControl();
            GEBalancesList.InitTHSListGridControl();
        }
        #endregion
    }
}
